<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="/favicon.ico" >
    <link rel="Shortcut Icon" href="/favicon.ico" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="../js/html5shiv.js"></script>
    <script type="text/javascript" src="../js/respond.min.js"></script>
    <![endif]-->
    <link href="../css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="../css/H-ui.css" />
    <link rel="stylesheet" type="text/css" href="../css/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="../css/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <title>基本设置</title>
</head>
<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i>
    首页 <span class="c-gray en">&gt;</span>
    用户管理 <span class="c-gray en">&gt;</span>
    自身密码修改 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
    <i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
    <form class="form form-horizontal" id="form-article-add">
        <div id="tab-system" class="HuiTab">
            <div class="tabBar cl">
                <span>修改密码</span>
            </div>
            <div class="tabCon">
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">
                        <span class="c-red">*</span>
                        旧密码：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="password" hidden="hidden">
                        <input type="password" id="oldPassword" name="oldPassword" placeholder="" value="" class="input-text">
                    </div>
                </div>

                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">
                        <span class="c-red">*</span>
                        新密码：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="password" id="password" name="password" placeholder="" value="" class="input-text">
                    </div>
                </div>

                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">
                        <span class="c-red">*</span>
                        确认密码：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="password" id="pwd" placeholder="" value="" class="input-text">
                    </div>
                </div>
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                <div onClick="article_save_submit();" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe632;</i> 提交</div>
            </div>
        </div>
    </form>
</div>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="/js/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/js/H-ui.js"></script>
<script type="text/javascript" src="/js/H-ui.min.js"></script>
<script type="text/javascript" src="/js/postJson.js"></script>
<script type="text/javascript" src="/js/root.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
    $(function(){
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });
        $.Huitab("#tab-system .tabBar span","#tab-system .tabCon","current","click","0");
    });

    function article_save_submit(){
        var oldPassword = $("#oldPassword").val();
        var password = $("#password").val();
        var pwd = $("#pwd").val();

        var dataCollect=$("#form-article-add").serialize();
        var dataCollects = dataCollect.replace(/\+/g," ")
        dataCollects= decodeURIComponent(dataCollects,true);//防止中文乱码
        var jsondata=strJSON.formToJson(dataCollects);//转化为json
        var url = "/sysUser/updatePwd";
            $.ajax({
                type: 'POST',
                url: url,
                contentType:"application/json",
                data:jsondata,
                dataType: 'json',
                success: function(msg){
                    // console.log(msg)
                    if(msg.success==false){
                        var errorMsg = msg.errorMessage;
                        layer.msg(errorMsg,{icon:1,time:3000});
                    }else{
                        $("#remark").val('');
                        $("#password").val('');
                        $("#pwd").val('');
                        layer.msg(msg.data,{icon:1,time:3000});
                        dologout()
                    }
                },
                error:function(XMLHttpRequest,textStatus,errorThrown){
                    var XmlStatus = XMLHttpRequest.status
//                         console.log(XMLHttpRequest.status)
                    if(XmlStatus==401){
                        alert(XmlError.error401)
                        parent.window.location.href = "../login.html"
                    }
                    if(XmlStatus==403){
                        alert(XmlError.error403)
                    }
                }
            });
    }

    function dologout() {
        var url = "/sys/dologout";
        $.ajax({
            url: url,
            type: "get",
            async: false,
            dataType: 'json',
            success: function (data) {
                window.parent.location.href = "login"
            },
            error:function(XMLHttpRequest,textStatus,errorThrown){
                var XmlStatus = XMLHttpRequest.status
//                         console.log(XMLHttpRequest.status)
                if(XmlStatus==401){
                    alert(XmlError.error401)
                    parent.window.location.href = "login"
                }
                if(XmlStatus==403){
                    alert(XmlError.error403)
                }
            }
        })
    }
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>